package com.simple.portal.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.simple.base.dao.BaseDAO;
import com.simple.portal.dao.IInitRightDAO;
import com.simple.portal.vo.InitRightIdVO;
import com.simple.portal.vo.InitRightVO;

@Repository("initRightDAO")
public class InitRightDAOImpl extends BaseDAO implements IInitRightDAO {

	@Override
	public InitRightVO findById(final InitRightIdVO initRightIdVO) {
		return (InitRightVO)super.get(InitRightVO.class, initRightIdVO);
	}

	@Override
	public void save(final InitRightVO initRightVO) {
		super.save(initRightVO);
	}
	
	@Override
	public void update(final InitRightVO initRightVO) {
		super.update(initRightVO);
	}

	@Override
	public List<InitRightVO> findAll() {
		return super.query(InitRightVO.class);
	}

	@Override
	public void delete(final InitRightVO initRightVO) {
		super.delete(initRightVO);
	}

	@Override
	public void delete(final InitRightIdVO initRightIdVO) {
		super.delete(InitRightVO.class, initRightIdVO);	
	}
	
	@Override
	public List<InitRightVO> findInitRightVOList(final String type,final String adminFlag){
		 	final StringBuffer sb = new StringBuffer(300);
		 	List<String> paramList=new ArrayList<String>();
		 	paramList.add(type);
		 	paramList.add(adminFlag);
		 	
	        sb.append( "select i from InitRightVO i where ");
	        sb.append("  i.id.organizationType=? ");
	        sb.append("  and i.id.adminFlag=? ");
			return  super.query(sb.toString(), paramList);
		
	}

}
